package b1.conifg
{
	public class LanguageConfig
	{
		private var metas:Array; 
		
		public function LanguageConfig(languageXML:XML)
		{
			metas = new Array();
			for (var i:int = 0; i < languageXML.meta.length(); i++)
			{
				var metaXML:XML = languageXML.meta[i];
				var meta:Array = new Array();
				for (var j:int = 0; j < metaXML.message.length(); j++)
				{
					meta.push(metaXML.message[j]);
				}
				metas.push(meta);
			}
		}
		
		public function getLanguage(metaIndex:int, messageIndex:int = -1):String
		{
			var meta:Array = metas[metaIndex];
			if (messageIndex < 0)
			{
				messageIndex = Math.random() * meta.length;
			}
			return meta[messageIndex];
		}
	}
}